<template>
  <div class="next-piece">
    <h3>Next Piece</h3>
    <div class="preview-board">
      <div v-for="(row, y) in piece" :key="y" class="row">
        <div 
          v-for="(cell, x) in row" 
          :key="x" 
          :class="['cell', { filled: cell }]"
          :style="{ backgroundColor: cell ? color : '' }"
        ></div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps<{
  piece: boolean[][];
  color: string;
}>();
</script>

<script lang="ts">
export default {
  name: 'NextPiece'
}
</script>

<style scoped>
.next-piece {
  background: #222;
  padding: 15px;
  border-radius: 8px;
  margin-left: 20px;
}

h3 {
  margin: 0 0 10px 0;
  color: white;
  text-align: center;
}

.preview-board {
  border: 2px solid #333;
  background: #111;
  padding: 4px;
}

.row {
  display: flex;
}

.cell {
  width: 20px;
  height: 20px;
  border: 1px solid #333;
}

.cell.filled {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}
</style>